#ifndef _AccountManager_H_
#define _AccountManager_H_

#include <string>
#include <vector>
#include <map>

struct LevelInfo
{
	std::string datetime;
	std::string userName;
	std::string userId;
	unsigned int score;
	int			good;
};

typedef std::map<std::string, LevelInfo> LevelInfoMap;

class AccountManagerDelegate
{
public:
	virtual void myScoreChanged(int score) = 0;
};

class AccountManager
{
protected:
	AccountManager();
public:
	~AccountManager(){};

	static AccountManager* sharedAccountManager();

	void setDelegate(AccountManagerDelegate* pDelegage)
	{
		m_pDelegate = pDelegage;
	}

	std::string getUserName();
	std::string getUserUin();
	unsigned int getScore();
	const std::string& getLoginTime();

	void setLoginTime(const char* loginTime);
	void setUserName(const std::string& userName);
	void setUserUin(const std::string& userUin);
	void login();
	void inputName();

	void setScore(unsigned int score);

	const std::map<std::string, LevelInfo>& getMyLevels();
	const std::map<std::string, LevelInfo>& getOverLevels();
	void addMyLevel(const char* levelname, const LevelInfo& levelInfo);
	void addOverLevel(const char* levelname, const LevelInfo& levelInfo);
	void requestMyInfo();

	bool addOrderform(const std::string& formStr, int nCount);
	bool delOrderform(const std::string& formStr);
	void checkOrderform();
private:
	std::string m_userUin;
	std::string m_userName;
	std::string m_loginTime;
	unsigned int m_score;
	std::map<std::string, LevelInfo> m_myLevels;
	std::map<std::string, LevelInfo> m_overLevels;

	AccountManagerDelegate* m_pDelegate;
};
#endif